let beginTime = endTime = 0;
//面对面建群 移动端
//第二版ip-groupNumber
function OperationfaceToFaceTime() {
	if (OperationTemp) {
		clearInterval(OperationTemp);
	}
	OperationTemp = setInterval(() => {
		try {
			Object.keys(faceToFaceList).forEach((value) => {
				if (timeDifference(new Date(), faceToFaceList[value].onlineTime) >=
					faceToFaceFailureTime) {
					let obj = {
						code: 200,
						type: 55,
						status: false, //群聊失效false,反之 true
						data: {
							groupNumber: faceToFaceList[value].groupNumber,
							signGroupNumber: faceToFaceList[value].signGroupNumber, //失效群聊名称
							ItemId: faceToFaceList[value].ItemId
						},
						message: "建群时间过长,请重新操作"
					}
					let handleData = Object.fromEntries(faceToFaceList[value].arr);
					Object.keys(handleData).forEach((userId) => {
						if (wsClients[userId]) {
							wsClients[userId].forEach((client) => {
								client.send(JSON.stringify(obj));
							});
						}
					})
					delete faceToFaceList[value];
					if (Object.keys(faceToFaceList).length == 0) {
						clearInterval(OperationTemp);
					}
				}
			})
		} catch (e) {
			console.log("面对面建群err", e);
		}
	}, OperationRate)


}

module.exports = OperationfaceToFaceTime;

// data: {
// 	groupNumber: value,
// 	ItemId: faceToFaceList[value].ItemId
// },